﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace POS
{
    /// <summary>
    /// Interaction logic for Ordered.xaml
    /// </summary>
    public partial class Ordered : Window
    {
        public Ordered()
        {         
            InitializeComponent();
            var timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick += (obj, args) =>
            {
                RenderOrders();
            };
            timer.Start();                   
        }

        private void ButtonBackToMainMenu(object sender, RoutedEventArgs e)
        {
            MainWindow mainMenuWindow = new MainWindow();
            mainMenuWindow.Show();
            this.Close();
        }

        private void RenderOrders()
        {     
            this.OrdersContainter.Children.Clear();
            this.OrdersContainter.Children.Add(Table.Render());
        }

        private void ButtonSaladsMenu(object sender, RoutedEventArgs e)
        {
            Salads buttonSaladsMenu = new Salads();
            buttonSaladsMenu.Show();
            this.Close();
        }

        private void ButtonHotDrinksMenu(object sender, RoutedEventArgs e)
        {
            HotDrinks buttonHotDrinksMenu = new HotDrinks();
            buttonHotDrinksMenu.Show();
            this.Close();
        }

        private void ButtonNonAlcoholicDrinksMenu(object sender, RoutedEventArgs e)
        {

            NonAlcoholicDrinks buttonNonAlcoholicMenu = new NonAlcoholicDrinks();
            buttonNonAlcoholicMenu.Show();
            this.Close();
        }

        private void ButtonAlcoholicDrinksMenu(object sender, RoutedEventArgs e)
        {
            AlcoholicDrinks buttonAlcoholicMenu = new AlcoholicDrinks();
            buttonAlcoholicMenu.Show();
            this.Close();
        }

        private void ButtonDessertsMenu(object sender, RoutedEventArgs e)
        {
            Desserts buttonDessertsMenu = new Desserts();
            buttonDessertsMenu.Show();
            this.Close();
        }

        private void ButtonMealsMenu(object sender, RoutedEventArgs e)
        {
            Meals buttonMealsMenu = new Meals();
            buttonMealsMenu.Show();
            this.Close();
        }
    }
}
